package com.shuda.business.engine.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 验证规则实体类
 * 用于存储数据验证规则配置
 * 
 * @author ink
 * @Description: 验证规则实体
 * @date 2024-10-10 14:30:00
 */
@Data
@TableName("validation_rule")
@Schema(name = "ValidationRuleEntity", description = "验证规则实体")
public class ValidationRuleEntity {

    @TableId(type = IdType.AUTO)
    @Schema(description = "主键ID")
    private Long id;

    @Schema(description = "规则名称")
    private String ruleName;

    @Schema(description = "规则类型(regex-正则表达式,range-数值范围,length-长度限制,required-必填项)")
    private String ruleType;

    @Schema(description = "规则内容(JSON格式存储)")
    private String ruleContent;

    @Schema(description = "错误提示信息")
    private String errorMessage;

    @Schema(description = "适用字段")
    private String applicableField;

    @Schema(description = "优先级")
    private Integer priority;

    @Schema(description = "状态(enabled-启用,disabled-禁用)")
    private String status;

    @Schema(description = "描述信息")
    private String description;

    @Schema(description = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "删除标记(0-正常,1-删除)")
    @TableLogic
    private Integer deleted;
}